﻿//-----------------------------------------------------------------------
// <copyright file="MLBrowser.cs" company="MAPILab Ltd">
//     Copyright (c) MAPILab Ltd.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace MAPILab.SharePoint.Explorer.Utilities.ScriptRunner
{
    /// <summary>
    /// Choose the way to display in object browser - the array as root object or array items as root objects
    /// </summary>
    public enum DisplayMode
    {
        /// <summary>
        /// Display array as root object
        /// </summary>
        Raw,
        /// <summary>
        /// Display array items as root objects
        /// </summary>
        Expanded
    }

    /// <summary>
    /// Class that calls by user from code form to display object(s) in browser window.
    /// </summary>
    public class MLBrowser
    {
        #region Fields

        /// <summary>
        /// Returned object
        /// </summary>
        protected object returnValue;// = null;

        /// <summary>
        /// Text of object browser
        /// </summary>
        protected string text;// = null;

        /// <summary>
        /// Display mode
        /// </summary>
        protected DisplayMode displayMode;// = DisplayMode.Raw;

        /// <summary>
        /// Open in new window
        /// </summary>
        protected bool openInNewWindow;// = false;

        #endregion

        #region Properties

        /// <summary>
        /// Get and set display mode
        /// </summary>
        public DisplayMode DisplayMode
        {
            get { return this.displayMode; }
            set { this.displayMode = value; }
        }

        /// <summary>
        /// Get and set object browser text
        /// </summary>
        public string Text
        {
            get { return this.text; }
            set { this.text = value; }
        }

        /// <summary>
        /// Get and set object to display in object browser
        /// </summary>
        public object ReturnValue
        {
            get { return this.returnValue; }
            set { this.returnValue = value; }
        }

        /// <summary>
        /// Get and set to open object browser in new window
        /// </summary>
        public bool OpenInNewWindow
        {
            get { return this.openInNewWindow; }
            set { this.openInNewWindow = value; }
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        public MLBrowser()
        {
            returnValue = null;
            text = null;
            displayMode = DisplayMode.Raw;
            openInNewWindow = true;
        }

        /*public MLBrowser(object returnedValue)
            : this()
        {            
            this.returnValue = returnedValue;
        }

        public MLBrowser(object returnValue, string text)
            : this()
        {
            this.returnValue = returnValue;
            this.text = text;
        }

        public MLBrowser(object returnValue, DisplayMode displayMode)
            : this()
        {
            this.returnValue = returnValue;
            this.displayMode = displayMode;
        }

        public MLBrowser(object returnValue, string text, DisplayMode displayMode)
            : this()
        {
            this.returnValue = returnValue;
            this.text = text;
            this.displayMode = displayMode;
        }*/

        #endregion
    }
}
